package com.chhuang.uresource.po;

import java.io.Serializable;
import java.util.Date;
import com.chhuang.core.model.AbstractPersistentModel;
import com.chhuang.core.validation.ValidGroupSave;
import com.chhuang.core.validation.ValidGroupUpdate;
import com.sun.xml.bind.CycleRecoverable;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import com.alibaba.fastjson.annotation.JSONField;

/**
* ChLog Model
* @author ChHuang
* @date Wed May 09 13:52:26 CST 2018
*/
public class ChLog extends AbstractPersistentModel implements CycleRecoverable{
	private static final long serialVersionUID = 5577496309234180553L;
	@NotNull(message="{ChLog.logId.NotNull}",groups={ValidGroupUpdate.class})
	@Size(max=32,message="{ChLog.logId.Size}",groups={ValidGroupSave.class})
	private String logId;
	public String getLogId(){
		return logId;
	}
	public void setLogId(String logId){
		this.logId=logId;
	}
	@NotNull(message="{ChLog.userId.NotNull}",groups={ValidGroupUpdate.class,ValidGroupSave.class})
	@Size(max=32,message="{ChLog.userId.Size}",groups={ValidGroupSave.class})
	private String userId;
	public String getUserId(){
		return userId;
	}
	public void setUserId(String userId){
		this.userId=userId;
	}
	@NotNull(message="{ChLog.username.NotNull}",groups={ValidGroupUpdate.class,ValidGroupSave.class})
	@Size(max=32,message="{ChLog.username.Size}",groups={ValidGroupSave.class})
	private String username;
	public String getUsername(){
		return username;
	}
	public void setUsername(String username){
		this.username=username;
	}
	@Size(max=65535,message="{ChLog.log.Size}",groups={ValidGroupSave.class})
	private String log;
	public String getLog(){
		return log;
	}
	public void setLog(String log){
		this.log=log;
	}
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	public Date getCreateTime(){
		return createTime;
	}
	public void setCreateTime(Date createTime){
		this.createTime=createTime;
	}
	@Override
	public Serializable getId() {
		return getLogId();
	}
	@Override
	public void setId(Serializable id) {
		setLogId((String)id);
	}
	@Override
	public Object onCycleDetected(Context arg0) {
		ChLog temp=new ChLog();
		temp.setLogId(logId);
		return temp;
	}
	@Override
	public String toString() {
		return "ChLog [logId="+logId+",userId="+userId+",username="+username+",log="+log+",createTime="+createTime+"]";
	}
}